var domUtils = UE.dom.domUtils;
var serverUrl =  ctx + "/ueditor/request";
var ueditorDefaultOptions = {
    //图片上传配置区
    serverUrl: serverUrl
    ,wordImageUrl:serverUrl + "/upload/editorFile"             //word转存提交地址
    ,wordImagePath:ctx + "/file/" ,

    webAppKey:"9HrmGf2ul4mlyK8ktO2Ziayd",
    shortcutMenu:["fontfamily", "fontsize", "bold", "italic", "underline", "forecolor", "backcolor", "insertorderedlist", "insertunorderedlist"],

	toolbars: [
		[ 'undo','bold', 'italic', 'underline', 'strikethrough', 'superscript', 'subscript', 'removeformat', 'formatmatch','blockquote', 'pasteplain', 
		'|', 'forecolor', 'backcolor', 'insertorderedlist', 'insertunorderedlist', 
		'lineheight','|','customstyle', 'paragraph', 'fontfamily', 'fontsize', '|',
		'directionalityltr', 'directionalityrtl', 'indent', '|',
		'justifyleft', 'justifycenter', 'justifyright', 'justifyjustify','|',
		'link', 'unlink', 'anchor', '|', 'imagenone', 'imageleft', 'imageright','imagecenter', '|',
		'insertimage', 'emotion','insertvideo','attachment',  'pagebreak', '|',
		'horizontal', 'date', 'time', 'spechars', '|','inserttable', 'deletetable'
		]
	],
	autoHeightEnabled: true,
	autoFloatEnabled: true,
	imageActionName :"/upload/editorFile",
	fileActionName :"/upload/editorFile",
	imageCompressEnable : false,
	imageMaxSize : 5242880,
	imageAllowFiles :[".png", ".jpg", ".jpeg", ".gif", ".bmp"],
	initialFrameWidth : 752, // 控件宽度
	initialFrameHeight : 400, // 控件高度
	fileActionName: "/resource/upload/editorFile", /* controller里,执行上传视频的action名称 */
	fileMaxSize: 51200000, /* 上传大小限制，单位B，默认50MB */
	fileAllowFiles: [
	        ".png", ".jpg", ".jpeg", ".gif", ".bmp",
	        ".flv", ".swf", ".mkv", ".avi", ".rm", ".rmvb", ".mpeg", ".mpg",
	        ".ogg", ".ogv", ".mov", ".wmv", ".mp4", ".webm", ".mp3", ".wav", ".mid",
	        ".rar", ".zip", ".tar", ".gz", ".7z", ".bz2", ".cab", ".iso",
	        ".doc", ".docx", ".xls", ".xlsx", ".ppt", ".pptx", ".pdf", ".txt", ".md", ".xml"
	],whitList: {
        a:      ['target', 'href', 'title', 'class', 'style'],
        abbr:   ['title', 'class', 'style'],
        address: ['class', 'style'],
        area:   ['shape', 'coords', 'href', 'alt'],
        article: [],
        aside:  [],
        audio:  ['autoplay', 'controls', 'loop', 'preload', 'src', 'class', 'style'],
        b:      ['class', 'style'],
        bdi:    ['dir'],
        bdo:    ['dir'],
        big:    [],
        blockquote: ['cite', 'class', 'style'],
        br:     [],
        caption: ['class', 'style'],
        center: [],
        cite:   [],
        code:   ['class', 'style'],
        col:    ['align', 'valign', 'span', 'width', 'class', 'style'],
        colgroup: ['align', 'valign', 'span', 'width', 'class', 'style'],
        dd:     ['class', 'style'],
        del:    ['datetime'],
        details: ['open'],
        div:    ['class', 'style'],
        dl:     ['class', 'style'],
        dt:     ['class', 'style'],
        em:     ['class', 'style'],
        font:   ['color', 'size', 'face'],
        footer: [],
        h1:     ['class', 'style'],
        h2:     ['class', 'style'],
        h3:     ['class', 'style'],
        h4:     ['class', 'style'],
        h5:     ['class', 'style'],
        h6:     ['class', 'style'],
        header: [],
        hr:     [],
        i:      ['class', 'style'],
        img:    ['src', 'alt', 'title', 'width', 'height', 'id', '_src', 'loadingclass', 'class', 'data-latex'],
        ins:    ['datetime'],
        li:     ['class', 'style'],
        mark:   [],
        nav:    [],
        ol:     ['class', 'style'],
        p:      ['class', 'style'],
        pre:    ['class', 'style'],
        s:      [],
        section:[],
        small:  [],
        span:   ['class', 'style'],
        sub:    ['class', 'style'],
        sup:    ['class', 'style'],
        strong: ['class', 'style'],
        table:  ['width', 'border', 'align', 'valign', 'class', 'style'],
        tbody:  ['align', 'valign', 'class', 'style'],
        td:     ['width', 'rowspan', 'colspan', 'align', 'valign', 'class', 'style'],
        tfoot:  ['align', 'valign', 'class', 'style'],
        th:     ['width', 'rowspan', 'colspan', 'align', 'valign', 'class', 'style'],
        thead:  ['align', 'valign', 'class', 'style'],
        tr:     ['rowspan', 'align', 'valign', 'class', 'style'],
        tt:     [],
        u:      [],
        ul:     ['class', 'style'],
        video:  ['autoplay', 'controls', 'loop', 'preload', 'src', 'height', 'width', 'class', 'style'],
        source: ['src', 'type'],
    	embed: ['type', 'class', 'pluginspage', 'src', 'width', 'height', 'align', 'style', 'wmode', 'play',  
    	      +  'autoplay','loop', 'menu', 'allowscriptaccess', 'allowfullscreen', 'controls', 'preload'],
    	iframe: ['src', 'class', 'height', 'width', 'max-width', 'max-height', 'align', 'frameborder', 'allowfullscreen']
    }
};
/**
 * 将ueditor的默认配置和当前传进来的配置做并集处理
 * @param configJson
 */
function joinJson(configJson){
	var temp = ($.isPlainObject(configJson) || !configJson) ? $.extend(true,{},ueditorDefaultOptions,configJson) : $.extend({},ueditorDefaultOptions);
	ueditorDefaultOptions = temp;
	return temp;
}